package com.woniuxy.controller;

import com.woniuxy.publisher.MsgPublisher;
import com.woniuxy.service.AiService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * AI控制器
 * 处理AI相关的HTTP请求
 */
@RestController
@RequestMapping("/ai")
public class AiController {

    @Resource
    private AiService aiService;

    @Resource
    private MsgPublisher msgPublisher;
    
    /**
     * AI聊天接口
     * @param message 用户输入的消息
     * @return 返回AI的响应内容
     */
    @PostMapping("/chat")
    public String chat(@RequestBody String message) {
        return aiService.getAiResponse(message);
    }
}
